package io.yuncheng.modules.sys.service.impl;

import io.yuncheng.modules.sys.dao.SubAppAlgorithmLogDao;
import io.yuncheng.modules.sys.entity.SubAppAlgorithmLogEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.yuncheng.common.utils.PageUtils;
import io.yuncheng.common.utils.Query;

import io.yuncheng.modules.sys.service.SubAppAlgorithmLogService;


@Service("subAppAlgorithmLogService")
public class SubAppAlgorithmLogServiceImpl extends ServiceImpl<SubAppAlgorithmLogDao, SubAppAlgorithmLogEntity> implements SubAppAlgorithmLogService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SubAppAlgorithmLogEntity> page = this.page(
                new Query<SubAppAlgorithmLogEntity>().getPage(params),
                new QueryWrapper<SubAppAlgorithmLogEntity>()
        );

        return new PageUtils(page);
    }
    @Override
    public IPage<SubAppAlgorithmLogEntity>  queryIPageEntity(Map<String, Object> params,SubAppAlgorithmLogEntity entity) {
        Object startDate = params.get("startDate");
        Object end = params.get("endDate");
        IPage<SubAppAlgorithmLogEntity> page = this.page(
                new Query<SubAppAlgorithmLogEntity>().getPage(params),
                new QueryWrapper<SubAppAlgorithmLogEntity>().setEntity(entity)
                        .ge(startDate!=null,"log_date",startDate)
                        .lt(end!=null,"log_date",end)
        );

        return page;
    }

}
